#ifndef __ROCKDODGER_GLOBALS_H__20101222
#define __ROCKDODGER_GLOBALS_H__20101222
#include <SDL/SDL.h>
#include "config.h"

//! Number of points per blubat kills
#define BLUBAT_KILL_POINTS 125

//! Number of points per greeble kills
#define GREEBLE_KILL_POINTS 100

//! Number of points per screen update
#define SCORE_INCREMENT_FACTOR 1

//! Size of the bangdots array
#define MAX_BANG_DOTS 0x15000

//! Maximum number of stars in the background
#define MAX_SPACE_DOTS 0x1000

//! Maximum number of engine exhaust dots
#define MAX_ENGINE_DOTS 0x2000

//! Maximum number of black points around the ship for collision detection.
#define MAX_BLACK_POINTS 500

#define POWERUPDELAY 511	//!< Skip so many frames before we get a new powerup
#define MAX_BLUBAT_IMAGES 8	//!< Max number of blubat image files
#define MAX_GREEBLE_IMAGES 15	//!< Max number of greeblie image files
#define MAX_GREEBLES 100	//!< Max number of greeblies
#define MAX_ROCKS 120		//!< MAX Rocks visible at once
#define NROCKS 6		//!< Number of rock image files, not number of rocks visible
#define MAX_POWERUP_IMAGES 64	//!< Maximum number of powerup images for the animation

//! TODO: ???
#define W 100


//! Width of the screen
extern int xsize;

//! Height of the screen
extern int ysize;

//! Fullscreen?
extern unsigned int opt_fullscreen;

/*! \brief Speed of the game
 *
 * This is set to number of ticks since last frame divided by 50. A
 * value of one means we are running at 50 frames per second. If the
 * game runs slower or faster it can be scaled appropriately.
 *
 */
extern float movementrate;

/*! Are we game over?
 *
 * A value of zero means that the game ist not over a value of one
 * says we reached the gameover state.
 */
extern int gameover;

extern float shieldlevel, laserlevel, shieldpulse;
extern int initialshield, fast;
extern RD_VIDEO_TYPE heatcolor[W * 3];


//! Available game states
enum states {
  TITLE_PAGE,
  GAME_PLAY,
  DEAD_PAUSE,
  GAME_OVER,
  HIGH_SCORE_ENTRY,
  HIGH_SCORE_DISPLAY,
  DEMO,
  SETUP
};

extern enum states state;	//!< current game state
extern float state_timeout;	//!< timeout before next game state switch

extern Uint32 initticks;	//! set at each start of the gameloop
extern Uint32 last_ticks;	//! set at each *end* of the draw function
extern Uint32 ticks_since_last;	//! at end of draw function: ticks_since_last = SDL_GetTicks()-last_ticks;

#endif
